<?php
include("../Class/SanPham_class.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<head>
<meta content="en-us" http-equiv="Content-Language" />
</head>

<body style="height: 114px">
<form action="Add_SP.php" method="post">
<div>Thêm Sản Phẩm</div>
	<table style="width: 100%">
		<tr>
			<td style="width: 128px">Tên Sản Phẩm</td>
			<td><input name="tensanpham" style="width: 236px" type="text" /></td>
		</tr>
		<tr>
			<td style="width: 128px">Hinh ảnh</td>
			<td><input name="hinhanh" style="width: 236px" type="text" /><input name="Button1" type="button" value="....." /></td>
		</tr>
		<tr>
			<td style="width: 128px">Giá </td>
			<td><input name="gia" style="width: 236px" type="text" /></td>
		</tr>
		<tr>
			<td style="width: 128px">Mô tả</td>
			<td><textarea name="mota" style="width: 236px; height: 31px"></textarea></td>
		</tr>
		<tr>
			<td style="width: 128px; height: 26px">Mã NSX</td>
			<td style="height: 26px">
			<input name="mansx" style="width: 236px" type="text" /></td>
		</tr>
		<tr>
			<td style="width: 128px; height: 26px">&nbsp;</td>
			<td style="height: 26px">
			<input name="Submit" type="submit" value="Thêm" /></td>
		</tr>
	</table>
<?php
if(isset ($_POST['tensanpham'])&& isset($_POST['hinhanh'])&& isset($_POST['gia'])&&isset($_POST['mota'])&&isset($_POST['mansx']))
{
	$TenSanPham=$_POST['tensanpham'];
	$HinhAnh=$_POST['hinhanh'];
	$Gia=$_POST['gia'];
	$MoTa=$_POST['mota'];
	$MaNSX=$_POST['mansx'];
	$sanpham=new SanPham();
	if($sanpham->Insert_SanPham($TenSanPham,$HinhAnh,$Gia,$MoTa,$MaNSX)>0)
	{
		header('location:Add_SP.php');
		echo "Thêm thành công sản phẩm !!!";
	}
	else
	{
		echo "Thêm thất bại !!!".@mysql_error();
	}

}
?>
</form>
</body>

</html>
